var path =  require('path');
var htmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
  entry : path.join(__dirname , "./src/js/main.js"),
  output: {
    path: path.join(__dirname,"./dist"),
    filename:'boundle.js'
  },
  plugins:[
    new htmlWebpackPlugin({
      template: path.join(__dirname,'./src/index.html'),
      fielname:'index.html'
    })
  ],
  module:{
    rules:[
      {test:/\.css$/,use:['style-loader','css-loader']}, //配置css文件的loader的规则
      {test:/\.scss$/,use:['style-loader','css-loader','scss-loader']}, //配置scss文件的loader规则
      {test:/\.(jpg|jpeg|png|gif|bmp)$/,use:'url-loader'}, //配置url解析图片文件的loader 
      {test:/\.(ttf|woff|woff2|eot|svg)$/, use:'url-loader'}, //字体图标的loader
      {test:/\.js$/,use:'babel-loader', exclude: /node_modules/}, //高级js语法的配置规则
      {test:/\.vue$/,use:'vue-loader', exclude: /node_modules/} //vue文件的loader配置规则
    ]
  }

}